<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title>POS收单运营管理平台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="<s:url value="/css/a.css"/>" type="text/css" rel="stylesheet" />
<link href="<s:url value="/css/index.css"/>" type="text/css" rel="stylesheet" />
<link href="<s:url value="/css/common.css"/>" type="text/css"
	rel="stylesheet" />
	
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.3.2.js" />"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-1.7.2.min.js" />"></script>
	
<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
<script language="javascript" type="text/javascript"
	src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>

<style>
　　　
　　　　　a {
	text-decoration: none
}

　　　　　a:hover {
	color: red;
	text-decoration: none
}

a:VISITED {
	color: red;
}
　　


　　　
</style>

<script type="text/javascript">
$(document).ready(function() {

    $("#buttonid").click(function(){ 
 	 	$("#buttonid").attr("disabled", true);
    	$("#queryUserForm").attr("action","<%=basePath%>/agentQuery/queryAgentListInfo.ct");
    	$("#queryUserForm").submit();
     });
    
	$("#editAgent").click(
			function() {
					var dd = $("input[name=multi_sel]:checked");
					if(dd.length != 1){
						alert("只能选择一个代理商进行设置！");
						return false;
					}
					var agentid = dd.val();
					if(dd.length == 0){
						alert("请选择代理商");
						return false;
					}else{
						$("#queryUserForm").attr("action","<%=basePath%>/agentQuery/queryAgent.ct?code="+agentid);
						$("#queryUserForm").submit();
					}					
		});

	    $("#szPower").click(function() {
			$("#queryUserForm").attr("action","<%=basePath%>/agentQuery/excelAgentListInfo.ct");
			$("#queryUserForm").submit();
	
		});
	});
	
    function checkbutten(m,n){
    	if(m==n){
    		document.getElementById("editAgent").disabled=false;
    	}
    	else{
    		document.getElementById("editAgent").disabled=true;
    	}
    }
	function addpanel(id,title,html) {
				window.parent.parent.document.getElementById("framemain").contentWindow.addtabs(id,title,html);
			}
	 		

	 //终端号分配
	 function deal(){
		 var dd = $("input[name=multi_sel]:checked");
		 if(dd.length != 1){
			alert("请选择一个代理商进行设置");
			return false;
		 }
		 var id = dd.val();
		 $("#queryUserForm").attr("action","serialNumQuery.ct?code="+id);
		 $("#queryUserForm").submit();
	}
	
	//终端号execl方式分配
	function execlDeal(){
		 var dd = $("input[name=multi_sel]:checked");
		 if(dd.length != 1){
			alert("请选择一个代理商进行设置");
			return false;
		 }
		 var id = dd.val();
		 window.location.href="<%=basePath%>serialNumLeading/serialNumLeadingJsp.ct?code="+id;
		 return false;
	}
	
</script>
</head>
<body>
		<s:form id="queryUserForm" action="/agentQuery/queryAgentListInfo.ct" method="post"
			theme="simple">
<table class="tb">
    <tbody>
		<tr class="tb-line">
			<td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
		</tr>
		<tr class="tb-line">
			<td class="tb-td" colspan="4"><div class="tb-h3">代理商查询</div></td>
		</tr>
		<tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">角色类型：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
					<s:select cssClass="queryWidth" name="searchCondition.role" list="#request.roleMap" listKey="key" listValue="value"
						headerKey="99" headerValue="--请选择--"  />
				</label>
			</td>
			
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">是否直属代理商：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
						<s:select cssClass="queryWidth" name="searchCondition.isDirectly" 
							list="#request.isDirectlyMap" listKey="key" listValue="value"/>		
				</label>
			</td>
				
			</tr>
			<tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">代理商账号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield id="accountNo"
							name="searchCondition.accountNo" cssClass="queryWidth" /><!-- </td> -->
				</label>
			</td>
					<!-- <td align="right"> -->
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">代理商姓名：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield id="realName"
							name="searchCondition.realName" cssClass="queryWidth" /><!-- </td> -->
				</label>
			</td>
			</tr>
			<tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">手机号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield id="mobile"
							name="searchCondition.mobile" cssClass="queryWidth" /><!-- </td> -->
				</label>
			</td>
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">证件号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield id="cardNo"
							name="searchCondition.cardNo" cssClass="queryWidth" /><!-- </td> -->
				</label>
			</td>
			</tr>
			<tr class="tb-line">
			
			<s:if test="#session.session_merchant.roleType==\"00\"||#session.session_merchant.roleType==\"01\"">
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">所属机构：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
						<s:select cssClass="queryWidth" name="searchCondition.orgCode" id="orgCode"
							list="#request.orgList" listKey="insIdCd" listValue="insName" 
							headerKey="99" headerValue="--请选择--" />		
					</label>
				</td>
			</s:if>
			<s:else>
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">所属机构：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
						<s:select cssClass="queryWidth" name="searchCondition.orgCode" id="orgCode"
							list="#request.orgList" listKey="insIdCd" listValue="insName" />		
					</label>
				</td>
			</s:else>
           
        <%--     <s:if test="#session.session_merchant.roleType==\"03\"||#session.session_merchant.roleType==\"15\" || #session.session_merchant.roleType==\"16\"">
		 --%>		<!-- <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4"></div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal"> -->
			<%-- 		  <s:hidden name="searchCondition.orgCode" value="%{#session.session_merchant.orgCode}" /> --%>
					<!-- </label>
				</td> -->
<%-- 			</s:if>
			<s:else>
	            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
	                <div class="tb-h4">所属机构：</div>
	            </td>
	            <td class="tb-td">
	                <label class="tb-input-normal">
						<s:select cssClass="queryWidth" name="searchCondition.orgCode"
							id="orgCode"
							list="#request.orgList" listKey="insIdCd" listValue="insName" />		
					</label>
				</td>
			</s:else> --%>
		        <td width="12%" style="min-width: 150px" align="right" class="tb-td">
		            <div class="tb-h4">创建时间：</div>
		        </td>
		        <td class="tb-td">
		 	        <label class="tb-input-mini"> 
		 	        	<s:textfield id="minDate" name="searchCondition.minDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" 
		 					theme="simple" cssClass="queryWidth" />  
		 			</label>至： 
		 			<label class="tb-input-mini">
		 				<s:textfield id="maxDate" name="searchCondition.maxDate" onFocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});" 
		 					theme="simple" cssClass="queryWidth" /> 
		 			</label> 
				</td>
			</tr>
				
			<tr>
		        <td width="12%" style="min-width: 150px" align="right" class="tb-td">
		            <div class="tb-h4">商户类别：</div>
		        </td>
		        <td class="tb-td">
					<s:select cssClass="queryWidth" name="searchCondition.groupCd" id="groupCd"
						list="#{'':'请选择','1':'直联','0':'间联','2':'间联直营'}" />	
				</td>
			</tr>
			<tr class="tb-line">
				<td colspan="4" align="center"><span style="font-color: red"><s:actionerror /></span>
					<span style="font-color: red;"><s:actionmessage /></span > <span style="font-color: red;"><s:fielderror
							cssClass="fieldError" /></span>
					<span id="otherError"></span>
				</td>
			</tr>
			<tr class="tb-line">
				<td  class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
					<input id="buttonid" value="查   询" type="button"/>
				</label>
                <label class="tb-input-submit">
                	<s:reset value="取  消" />
				</label>
				<s:if test="#request.searchRsList!=null&&#request.searchRsList.size()>0">
	                <label class="tb-input-submit">
							<input type="button" id="fenpei" value="终端SN号分配" onclick="deal()">
					</label>
	                <label class="tb-input-submit">
							<input type="button" id="execlfenpei" value="终端SN号批量分配" onclick="execlDeal()">
					</label>
	                <label class="tb-input-submit">
						<input id="szPower" type="button" value="导出Excel" />
					</label>
				</s:if>
				<s:else>
	                <label class="tb-input-submit">
							<input type="button" disabled="disabled" id="fenpei" value="终端SN号分配" onclick="deal()">
					</label>
	                <label class="tb-input-submit">
							<input type="button" disabled ="disabled" id="execlfenpei" value="终端SN号批量分配" onclick="execlDeal()">
					</label>
		           <!--  <label class="tb-input-submit">
						<input id="szPower" disabled="disabled" value="导出Excel" type="button" />
					</label> -->
				</s:else>
					<!-- 
					<s:submit id="editAgent" disabled ="true" value="代理商信息完善" />
					 -->
				</td>	
			</tr>
			</table>
		</s:form>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<s:if
					test="#request.searchRsList != null && #request.searchRsList.size>0">
					<tr class="tb-line">
						<td class="tb-td paging" colspan="12" align="left">&nbsp;&nbsp;&nbsp;&nbsp; <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/agentQuery/queryAgentListInfo.ct?currentPage=" />

						</td>
					</tr>
				</s:if>
			</table>
			
		<div class="big-tb">
		    <table id="tableList" class="tb" style="width: 100%;">
				<thead>
		            <tr class="tb-line">
		                <th class="tb-th" colspan="14">代理商基本信息列表</th>
		            </tr>
					<tr class="tb-line bg-gray">
						<th class="tb-th">选择</th>
						<th class="tb-th">账号</th>
						<th class="tb-th">姓名</th>
						<th class="tb-th">性别</th>
						<th class="tb-th">手机号</th>
						<s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						  <th class="tb-th">所属机构</th> 
						 </s:if>
						<th class="tb-th">角色类型</th>
						<th class="tb-th">证件号</th>
						<s:if test=" #request.invoiceRateFlag==\"1\"  ">
							<th class="tb-th">发票扣率</th>
							<th class="tb-th">序号编码</th>
						</s:if>
						<th class="tb-th">操作</th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="#request.searchRsList" status="stat" id="oper">
						<tr class="tb-line">
							<td class="tb-td" align="center">
							<s:if test="#session.session_merchant.id==#oper.superiorId || (#session.session_merchant.roleType==\"14\" && (#oper.roleType==\"02\" || #oper.roleType==\"03\")) || (#request.isSdsyb==\"1\" && #oper.roleType==\"18\" ) || (#session.session_merchant.roleType==\"18\" && (#oper.roleType==\"02\" || #oper.roleType==\"03\"))">
								<s:checkboxlist name="multi_sel"  list="#{#oper.id:''}" onchange="checkbutten('%{#session.session_merchant.id}','%{#oper.superiorId}')" theme="simple" />
					        </s:if>
					        <s:else>
					        	<s:checkboxlist name="multi_sel" disabled="true" list="#{#oper.id:''}" onchange="checkbutten('%{#session.session_merchant.id}','%{#oper.superiorId}') " theme="simple" />
					        </s:else>
					        </td>
							<td class="tb-td" align="center">
							 <s:property value="#oper.accountNo"/>
							</td>
							<td class="tb-td" align="center">
							<s:property value="#oper.realName"/>
							</td>
					        <td class="tb-td" align="center"> 
					        <s:property value="#oper.sex"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.mobile"/>
							</td>
							<s:if test="#session.session_merchant.roleType!=\"03\" && #session.session_merchant.roleType!=\"15\" && #session.session_merchant.roleType!=\"16\"">
						    <td class="tb-td" align="center"> 
					        	<s:property value="#oper.orgName"/>
							</td>
						   </s:if>
						 
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.roleName"/>
							</td>
							<td class="tb-td" align="center"> 
					        <s:property value="#oper.cardNo"/>
							</td>
							<s:if test=" #request.invoiceRateFlag==\"1\"  ">
								<td class="tb-td" align="center"> 
					        		<s:property value="#oper.taxRegistrationCertificate"/>
								</td>
								<td class="tb-td" align="center"> 
					        		<s:property value="#oper.organizationCode"/>
								</td>
							</s:if>
							<td class="tb-td" align="center">
								<s:if test="#oper.roleType!=\"18\" ">
						        	<a href="javascript:addpanel('','代理商详细信息','<%=basePath%>agentQuery/queryAgentViewInfo.ct?merchant.accountNo=<s:property value="#oper.accountNo"/>')">详情</a>
								</s:if>
					       </td>
						</s:iterator>
				</tbody>
			</table>
	</div>
</body>
</html>
